<template>
  <div class="category">
    <nav-bar>
      <div class="navbar-search">
        <span>石家庄</span>
        <svg-icon name="unfold"></svg-icon>
        <div class="search-form">
          <svg-icon name="search" color="#C9C7C7"></svg-icon>
          <input type="text" placeholder="请输入搜索内容">
        </div>
      </div>
    </nav-bar>
    <div class="top-tab">
      <better-scroll direction="horization">
        <div class="tab-item" v-for="(item, idx) in tabData" :key="idx" :class="{ active: idx === 2 }">{{item}}</div>
      </better-scroll>
    </div>
    <div class="flower-content">
      <better-scroll>
        <ul class="flower-list">
          <li v-for="(item, idx) in 30" :key="idx" @click="jumpToPage">
            <img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fdingyue.ws.126.net%2F2020%2F0202%2F8397157dj00q526bs005vc000jp00k2m.jpg&refer=http%3A%2F%2Fdingyue.ws.126.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639765669&t=4fde367c2a2cedb6f39da616826aae55" alt="">
            <span>文竹</span>
          </li>
        </ul>
      </better-scroll>
    </div>
  </div>
</template>

<script>
import NavBar from '@/components/NavBar.vue'
import BetterScroll from '@/components/BetterScroll.vue'

export default {
  data () {
    return {
      tabData: ['小森林盆栽', '观叶小盆栽', '观花小盆栽', '观果小盆栽', '其它小盆栽']
    }
  },

  methods: {
    jumpToPage () {
      this.$router.push('/classify-detail/1')
    }
  },

  components: {
    NavBar,
    BetterScroll
  }
}
</script>

<style scoped>
.category {
  height: 100%;
  background: #fff;
}
.navbar-search {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 0 36px;
}
.navbar-search > span {
  font-size: 28px;
  color: #fff;
  margin-right: 15px;
}
.search-form {
  display: flex;
  align-items: center;
  margin-left: 25px;
  flex: 1;
  height: 44px;
  border-radius: 5px;
  background-color: #fff;
  padding: 0 12px;
}
.search-form > input {
  height: 100%;
  padding: 0;
  flex: 1;
  outline: none;
  border: none;
  text-indent: 20px;
  font-size: 24px;
}
.search-form > input::placeholder {
  font-size: 22px;
  line-height: 44px;
  color: #C9C7C7;
}
.top-tab {
  width: 100%;
  height: 66px;
  border-bottom: 1px solid #DCDCDC;
  padding: 0 14px;
  box-sizing: border-box;
}
.top-tab .tab-item {
  position: relative;
  height: 100%;
  font-size: 24px;
  color: #666;
  min-width: 160px;
  line-height: 65px;
  text-align: center;
}
.top-tab .tab-item.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-color: #67B85F;
}
.flower-content {
  height: calc(100% - 258px);
}
.flower-list {
  padding: 30px 40px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-column-gap: 32px;
  grid-row-gap: 62px;
}
.flower-list > li {
  height: 190px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}
.flower-list > li > img {
  display: block;
  width: 100%;
}
.flower-list > li > span {
  font-size: 24px;
  color: #666666;
}
</style>
